<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Struct template string_parse_tree</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../date_time/doxy.html#doxygen.date_time_reference.string__parse__tree_8hpp" title="Header &lt;boost/date_time/string_parse_tree.hpp&gt;">
<link rel="prev" href="structboost_1_1date__time_1_1parse__match__result.html" title="Struct template parse_match_result">
<link rel="next" href="strings__from__facet_8hpp_1af11986f3b1929bb14e204da5bff4f4ce.html" title="Function template gather_month_strings">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="structboost_1_1date__time_1_1parse__match__result.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../date_time/doxy.html#doxygen.date_time_reference.string__parse__tree_8hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="strings__from__facet_8hpp_1af11986f3b1929bb14e204da5bff4f4ce.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Struct template string_parse_tree</span></h2>
<p>boost::date_time::string_parse_tree — Recursive data structure to allow efficient parsing of various strings. </p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../date_time/doxy.html#doxygen.date_time_reference.string__parse__tree_8hpp" title="Header &lt;boost/date_time/string_parse_tree.hpp&gt;">boost/date_time/string_parse_tree.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> charT<span class="special">&gt;</span> 
<span class="keyword">struct</span> <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html" title="Struct template string_parse_tree">string_parse_tree</a> <span class="special">{</span>
  <span class="comment">// types</span>
  <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">multimap</span><span class="special">&lt;</span> <span class="identifier">charT</span><span class="special">,</span> <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html" title="Struct template string_parse_tree">string_parse_tree</a><span class="special">&lt;</span> <span class="identifier">charT</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a292b763d2554312604d3fc57df4ad111"></a><span class="identifier">ptree_coll</span><span class="special">;</span>             
  <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">multimap</span><span class="special">&lt;</span> <span class="identifier">charT</span><span class="special">,</span> <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html" title="Struct template string_parse_tree">string_parse_tree</a> <span class="special">&gt;</span>          <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a3c98309f061ada23ed40ee0a84d17831"></a><span class="identifier">ptree_coll</span><span class="special">;</span>             
  <span class="keyword">typedef</span> <span class="identifier">ptree_coll</span><span class="special">::</span><span class="identifier">value_type</span>                             <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a46b2d3529306bcb7c7ef6accdf461093"></a><span class="identifier">value_type</span><span class="special">;</span>             
  <span class="keyword">typedef</span> <span class="identifier">ptree_coll</span><span class="special">::</span><span class="identifier">iterator</span>                               <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a1864847e487344d75468c63b33d403e1"></a><span class="identifier">iterator</span><span class="special">;</span>               
  <span class="keyword">typedef</span> <span class="identifier">ptree_coll</span><span class="special">::</span><span class="identifier">const_iterator</span>                         <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a4b619e72bd9ad19e634239a62ac38fa3"></a><span class="identifier">const_iterator</span><span class="special">;</span>         
  <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span> <span class="identifier">charT</span> <span class="special">&gt;</span>                         <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a90a73073eedbbc80aff749a0a3b83a1d"></a><span class="identifier">string_type</span><span class="special">;</span>            
  <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span> <span class="identifier">charT</span> <span class="special">&gt;</span> <span class="special">&gt;</span>          <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1ad57df33de8513a9a1bedd973a88da4a1"></a><span class="identifier">collection_type</span><span class="special">;</span>        
  <span class="keyword">typedef</span> <a class="link" href="structboost_1_1date__time_1_1parse__match__result.html" title="Struct template parse_match_result">parse_match_result</a><span class="special">&lt;</span> <span class="identifier">charT</span> <span class="special">&gt;</span>                        <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a257e5d44ecc8b7d97191482d353eabc5"></a><span class="identifier">parse_match_result_type</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#id-1_3_11_15_3_43_1_1_2_14-bb">public member functions</a></span>
  <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1abb9d26956a778384eceb58ad18c67682"><span class="identifier">string_parse_tree</span></a><span class="special">(</span><span class="identifier">collection_type</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1ab3111330e689b1179e7bdffe911aaf9f"><span class="identifier">string_parse_tree</span></a><span class="special">(</span><span class="keyword">short</span> <span class="special">=</span> <span class="identifier">parse_match_result_type</span><span class="special">::</span><span class="identifier">PARSE_ERROR</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1ac363fedd2cdefe0df2c5c98b46fa6fec"><span class="identifier">insert</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">string_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">short</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">short</span> <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a2b5d0e0d61a4a6bd329dffcc03c38a84"><span class="identifier">match</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">istreambuf_iterator</span><span class="special">&lt;</span> <span class="identifier">charT</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> 
              <span class="identifier">std</span><span class="special">::</span><span class="identifier">istreambuf_iterator</span><span class="special">&lt;</span> <span class="identifier">charT</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a257e5d44ecc8b7d97191482d353eabc5">parse_match_result_type</a> <span class="special">&amp;</span><span class="special">,</span> 
              <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a257e5d44ecc8b7d97191482d353eabc5">parse_match_result_type</a> 
  <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a78ad450e1b555210dc66f6915ca5a3a9"><span class="identifier">match</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">istreambuf_iterator</span><span class="special">&lt;</span> <span class="identifier">charT</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> 
        <span class="identifier">std</span><span class="special">::</span><span class="identifier">istreambuf_iterator</span><span class="special">&lt;</span> <span class="identifier">charT</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1abaa974084d417abd9127b56d408755a0"><span class="identifier">printme</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">int</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a354976230a53756659f2e0c810aba55d"><span class="identifier">print</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a31ee096e8a4637b47b4f1c49f511f0ee"><span class="identifier">printmatch</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">charT</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// public data members</span>
  <span class="identifier">ptree_coll</span> <span class="identifier">m_next_chars</span><span class="special">;</span>
  <span class="keyword">short</span> <span class="identifier">m_value</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.11.15.3.42.4.4"></a><h2>Description</h2>
<p>This class provides a quick lookup by building what amounts to a tree data structure. It also features a match function which can can handle nasty input interators by caching values as it recurses the tree so that it can backtrack as needed. </p>
<div class="refsect2">
<a name="id-1.3.11.15.3.42.4.4.3"></a><h3>
<a name="id-1_3_11_15_3_43_1_1_2_14-bb"></a><code class="computeroutput">string_parse_tree</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1abb9d26956a778384eceb58ad18c67682"></a><span class="identifier">string_parse_tree</span><span class="special">(</span><span class="identifier">collection_type</span> names<span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> starting_point <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span></pre>
<p>Parameter "starting_point" designates where the numbering begins. A starting_point of zero will start the numbering at zero (Sun=0, Mon=1, ...) were a starting_point of one starts the numbering at one (Jan=1, Feb=2, ...). The default is zero, negative vaules are not allowed </p>
</li>
<li class="listitem"><pre class="literallayout"><a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1ab3111330e689b1179e7bdffe911aaf9f"></a><span class="identifier">string_parse_tree</span><span class="special">(</span><span class="keyword">short</span> value <span class="special">=</span> <span class="identifier">parse_match_result_type</span><span class="special">::</span><span class="identifier">PARSE_ERROR</span><span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1ac363fedd2cdefe0df2c5c98b46fa6fec"></a><span class="identifier">insert</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">string_type</span> <span class="special">&amp;</span> s<span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">short</span> value<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">short</span> <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a2b5d0e0d61a4a6bd329dffcc03c38a84"></a><span class="identifier">match</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">istreambuf_iterator</span><span class="special">&lt;</span> <span class="identifier">charT</span> <span class="special">&gt;</span> <span class="special">&amp;</span> sitr<span class="special">,</span> 
            <span class="identifier">std</span><span class="special">::</span><span class="identifier">istreambuf_iterator</span><span class="special">&lt;</span> <span class="identifier">charT</span> <span class="special">&gt;</span> <span class="special">&amp;</span> stream_end<span class="special">,</span> 
            <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a257e5d44ecc8b7d97191482d353eabc5">parse_match_result_type</a> <span class="special">&amp;</span> result<span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="special">&amp;</span> level<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Recursive function that finds a matching string in the tree. <p>Must check match_results::has_remaining() after <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a2b5d0e0d61a4a6bd329dffcc03c38a84">match()</a> is called. This is required so the user can determine if stream iterator is already pointing to the expected character or not (<a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a2b5d0e0d61a4a6bd329dffcc03c38a84">match()</a> might advance sitr to next char in stream).</p>
<p>A <a class="link" href="structboost_1_1date__time_1_1parse__match__result.html" title="Struct template parse_match_result">parse_match_result</a> that has been returned from a failed match attempt can be sent in to the match function of a different <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html" title="Struct template string_parse_tree">string_parse_tree</a> to attempt a match there. Use the iterators for the partially consumed stream, the <a class="link" href="structboost_1_1date__time_1_1parse__match__result.html" title="Struct template parse_match_result">parse_match_result</a> object, and '0' for the level parameter. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a257e5d44ecc8b7d97191482d353eabc5">parse_match_result_type</a> 
<a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a78ad450e1b555210dc66f6915ca5a3a9"></a><span class="identifier">match</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">istreambuf_iterator</span><span class="special">&lt;</span> <span class="identifier">charT</span> <span class="special">&gt;</span> <span class="special">&amp;</span> sitr<span class="special">,</span> 
      <span class="identifier">std</span><span class="special">::</span><span class="identifier">istreambuf_iterator</span><span class="special">&lt;</span> <span class="identifier">charT</span> <span class="special">&gt;</span> <span class="special">&amp;</span> stream_end<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Must check match_results::has_remaining() after <a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a2b5d0e0d61a4a6bd329dffcc03c38a84">match()</a> is called. This is required so the user can determine if stream iterator is already pointing to the expected character or not (<a class="link" href="structboost_1_1date__time_1_1string__parse__tree.html#doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a2b5d0e0d61a4a6bd329dffcc03c38a84">match()</a> might advance sitr to next char in stream). </p>
</li>
<li class="listitem"><pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1abaa974084d417abd9127b56d408755a0"></a><span class="identifier">printme</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span> os<span class="special">,</span> <span class="keyword">int</span> <span class="special">&amp;</span> level<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a354976230a53756659f2e0c810aba55d"></a><span class="identifier">print</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span> os<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.date_time_reference.structboost_1_1date__time_1_1string__parse__tree_1a31ee096e8a4637b47b4f1c49f511f0ee"></a><span class="identifier">printmatch</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span> os<span class="special">,</span> <span class="identifier">charT</span> c<span class="special">)</span><span class="special">;</span></pre></li>
</ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2001-2005 CrystalClear Software, Inc<p>Subject to the Boost Software License, Version 1.0. (See accompanying file
    <code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="structboost_1_1date__time_1_1parse__match__result.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../date_time/doxy.html#doxygen.date_time_reference.string__parse__tree_8hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="strings__from__facet_8hpp_1af11986f3b1929bb14e204da5bff4f4ce.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
